#if !defined(DRV_SERVER_H)
#define DRV_SERVER_H


#include "drv_packer.h"

typedef struct
{
    uint8_t t;                                       //消息包类型
    uint8_t (*handle)(uint8_t *body, uint16_t size); //命令回调函数                                          //帮助信息
} Server_Handler_Struct;

uint8_t ServerHandler(uint8_t type, uint8_t *data, uint16_t len);

__attribute__((weak))  void User_LoginHandler(uint8_t status);
__attribute__((weak))  void User_DisconHandler(uint8_t status);
__attribute__((weak))  void User_P2pAndGroupHandler(uint8_t *body, uint16_t size);

uint8_t HearthBeatReq(CMD_Packer *cmd);
uint8_t LoginReq(CMD_Packer *cmd, uint8_t *user, uint8_t usize, uint8_t *pswd, uint8_t psize);
uint8_t DisconReq(CMD_Packer *cmd);
uint8_t P2pReq(CMD_Packer *cmd, int id, uint8_t *body, uint16_t size);
uint8_t GroupReq(CMD_Packer *cmd, uint8_t *body, uint16_t size);

#endif // DRV_SERVER_H
